﻿using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Interfaces.Inherited_Interfaces;
using Interfaces.Information_Interfaces;
using Presenters;

namespace Views.Status_Views
{
    public partial class ErrorView : Form, IErrorView
    {
        ErrorViewPresenter presenter = null;

        public ErrorView()
        {
            InitializeComponent();
            presenter = new ErrorViewPresenter(this);
        }

        string IErrorView.exception
        {
            get
            {
                return label2.Text;
            }
            set
            {
                label2.Text = value as String;
            }
        }

        string IErrorView.nameOperation
        {
            get
            {
                return label1.Text;
            }
            set
            {
                label1.Text = String.Format("Błąd operacji: {0}", value);
            }
        }

        void ICloseable.Close()
        {
            this.Close();
        }

        private void toolStripLabel1_Click(object sender, EventArgs e)
        {
            presenter.ExitApp();
        }

        T IView.ReturnView<T>()
        {
            return (T)((object)this);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            presenter.ExitApp();
        }
    }
}
